/*
 * Copyright (c) 2009, Jan Pastor. All Rights Reserved.
 */

package sk.jp.commons.utils;

import sk.jp.commons.tools.MemoryState;

/**
 * Logging utilities.
 */
public class LogUtil {

    private LogUtil() {
    }

    /**
     * Creates log message with current memory state (usage).
     * <p>It is recommended to check if is logging enabled for used log-level
     * before call this method.
     * @return log message.
     */
    public static String getMemoryStateLogMessage() {
        MemoryState ms = MemoryState.get();

        return LogMsg.toString("Memory state", "usage[%]", ms.totalUsedMemoryPerc,
                                  "usage[MB]", ms.convert(ms.totalUsedMemory, MemoryState.MBYTES), 
                                  "maxMemory[MB]", ms.convert(ms.totalMaxMemory, MemoryState.MBYTES));
    }

}
